package com.augurit.gzcgwsp.common.util;

import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.augurit.common.util.lang.DateUtils;

public class CommonUtils {
    
    public static String convertSeqToAcceptNo(Long seq) {
        try {
            String yymmdd = DateUtils.dateTimeToString(new Date(), DateUtils.YYYYMMDD);
            String seqStr = seq + "";
            
            if (seqStr.length() == 1) seqStr = "00000" + seqStr;
            else if (seqStr.length() == 2) seqStr = "0000" + seqStr;
            else if (seqStr.length() == 3) seqStr = "000" + seqStr;
            else if (seqStr.length() == 4) seqStr = "00" + seqStr;
            else if (seqStr.length() == 5) seqStr = "0" + seqStr;
            
            return yymmdd.substring(2) + seqStr;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 判断是否包含某个字符串
     * @param str
     * @param searchChars
     * @return 
     * @date 2012-4-22
     */
	 /**
	  * 查询字符串是否含有某个字符串
	  * @param str 字符串
	  * @param regEx 查询的字符串
	  * @return
	  */
	  public static  boolean containsStr(String str, String regEx) {
	        boolean flag=false;
	        try{
	            Pattern p = Pattern.compile(regEx,Pattern.CASE_INSENSITIVE);
	            Matcher m = p.matcher(str);  
	            flag= m.find();
	        }catch(Exception e){
	          e.printStackTrace();
	        }
	       return flag;
	    }
	  
	  
	  public static void main(String[] args){
		 
		  System.out.print( containsStr("从事城市生活垃圾经营性处置服务许可审批","处置服务许可"));
	  }
}
